package nzk.hssftemp.dummy;

import nzk.hssftemp.*;

import java.util.List;

/**
 * Sample usage of HSSFTemplate. extend and override.
 
 * @author N. Zulkarnaen (n.zulkarnaen@gmail.com)
 *         Date: 7/11/13
 *         Time: 11:40 AM
 * @version $Revision: 7 $
 */
public class ARCardXls extends HSSFTemplate {

    private String customer;
    private String dateRange;

    @Override
    protected void initParameters() {
        parameters = new Parameter[]{
                new Parameter("Customer", customer),
                new Parameter("Period", dateRange),
        };
    }

    @Override
    protected void initColumns() {
        columns = new Column[]{
                new Column(),
                new Column("Date", new ColumnProp("date", Format.DATE)),
                new Column("Number", new ColumnProp("number", Format.NUMBER)),
                new Column("Description", new ColumnProp("description", Format.NUMBER)),
                new Column("Giro", new ColumnProp("giro", Format.DATE)),
                new Column("Fx Amount", new ColumnProp("fxAmount", Format.MONEY_5D, "rate>1"), new ColumnProp("currencySymbol", Format.NUMBER)),
                new Column("Rate", new ColumnProp("rate", Format.MONEY_2D)),
                new Column("Debt", new ColumnProp("debt", Format.MONEY_2D)),
                new Column("Credit", new ColumnProp("credit", Format.MONEY_2D)),
                new Column("Balance", new ColumnProp("balance", Format.MONEY_2D))
        };
    }

    @Override
    public void build() throws NoSuchFieldException, IllegalAccessException {
        super.build();
        createTotals(0, 8, new int[]{8, 9});
    }

    public ARCardXls(String title, List<?> list, String customer, String dateRange) {
        super(title, list);
        this.customer = customer;
        this.dateRange = dateRange;
    }


}
